<?php
/**
 * winbinder 패키지 
 * 
 * 
 * @package php.ui.winbinder
 */

/**
 * Color class 
 *
 * <code>
 * // r,g,b = 255,0,0
 * wbcolor(255, 0, 0)  
 * WBColor::create(255, 0, 0)
 *   
 * // RED , winbinder constants
 * wbcolor('red'); 
 * WBColor::createByString('red');
 * </code>
 *
 * @package php.ui.winbinder
 */
class WBColor extends PObject { 
	private $_r = 0;
	private $_g = 0;
	private $_b = 0;
	
	public function __construct($r = 0, $g = 0, $b = 0) { 
		$this->_r = $r;
		$this->_g = $g;
		$this->_b = $b;
	}
	
	public function getColor() { 
		return ($this->_r << 16 | $this->_g << 8 | $this->_b ); 
	}
	
	public static function create($r = 0, $g = 0, $b = 0) { 
		$color = new WBColor($r, $g, $b);
		return $color->getColor();
	}
	
	public static function createByString($color) { 
		$color = strtoupper($color);
		
		if (defined($color)) { 
			return constant($color);
		}
		
		return NOCOLOR;
	}
}

?>